Hello all,
I am back with my interface.
The problem is : I have a list in which a user can make a choice...
But if he chooses an answer and finally doesn't want to answer at all (it's possible) how can he unselect the element of the list chooses before ?
At the moment it's a simple list :
string listChoice [] = {"choice1" ,
"choice2"}
choice = list (db_md5_main_window, "", 2, listChoice)
set(choice, function_choice)
Is it possible to do what I want ?
Liise - Mon Jul 25 10:30:11 EDT 2016 |
|
Re: Unselect a list element PekkaMakinen - Wed Jul 27 03:01:45 EDT 2016
Note that the "set" function has also a form in which you can set a double-click action for list. So you UI could have deselection by double-clicking on a selected item
set(select, deselect, and activate)
Declaration void set(DBE listView, void select(DBE, int), void deselect(DBE, int), void activate(DBE, int))
Operation
Attaches three callback functions to a list view.
The first callback fires when an option is selected (a single click); the second fires when an option is deselected (a side effect of a single click on another item); the third fires when an item is activated (a double click).
All callbacks must be of the form: void select(DBE listView, int selected){}
|
|
Re: Unselect a list element Liise - Thu Jul 28 04:05:36 EDT 2016
First of all, thank you very much for your answer !
There are some things I don't understand ...
I have 2 choices and I would like to be able to take neither of the 2
In the "set" function I put an int which get my choice but I don't know how to manage, is it the right way ?
I don't understand how I can use the different select / deselect / activate functions with this int.
Moreover when I double-click on a choice it seems to stay in "blue highlighted" for the moment.
Sorry for all those questions, this langage is quite obscure for me 
|
|
Re: Unselect a list element PekkaMakinen - Fri Jul 29 01:38:56 EDT 2016 Liise - Thu Jul 28 04:05:36 EDT 2016
First of all, thank you very much for your answer !
There are some things I don't understand ...
I have 2 choices and I would like to be able to take neither of the 2
In the "set" function I put an int which get my choice but I don't know how to manage, is it the right way ?
I don't understand how I can use the different select / deselect / activate functions with this int.
Moreover when I double-click on a choice it seems to stay in "blue highlighted" for the moment.
Sorry for all those questions, this langage is quite obscure for me 
Sorry, I mentioned the wrong function - that is meant for listViews, not for lists. The correct only has only two callbacks
void set(DBE element, void select(DBE), void activate(DBE))
Operation Attaches two callback functions to a list or tree view.
and modifying the example on that to use double-click to remove selection
DB listBox = create "The Good Numbers"
string states[]={"New Jersey", "Virginia", "Texas", "California", "Europe"}
string phones[]={"201 442-4600", "703 904-4360", "817 588-3008", "408 879-2344", "+44 1865 784285"}
DBE abcList = list(listBox, "ABC Offices:", 200, 8, states)
full listBox
DBE telNo = field(listBox, "Telephone:", "", 30, true)
void onSelection(DBE l)
{
int sel = get abcList
if (sel >= 0) {
set(telNo, phones[sel])
} else {
set(telNo, "")
}
} // onSelection
void onActivate(DBE l)
{
int sel = get abcList
if (sel >= 0)
{
// remove selection on double-click
set(abcList, sel, false)
set(telNo, "")
}
} // onActivate
set(abcList, onSelection, onActivate)
show listBox
|
|
Re: Unselect a list element Wolfgang Uhr - Fri Jul 29 08:52:16 EDT 2016 PekkaMakinen - Fri Jul 29 01:38:56 EDT 2016
Sorry, I mentioned the wrong function - that is meant for listViews, not for lists. The correct only has only two callbacks
void set(DBE element, void select(DBE), void activate(DBE))
Operation Attaches two callback functions to a list or tree view.
and modifying the example on that to use double-click to remove selection
DB listBox = create "The Good Numbers"
string states[]={"New Jersey", "Virginia", "Texas", "California", "Europe"}
string phones[]={"201 442-4600", "703 904-4360", "817 588-3008", "408 879-2344", "+44 1865 784285"}
DBE abcList = list(listBox, "ABC Offices:", 200, 8, states)
full listBox
DBE telNo = field(listBox, "Telephone:", "", 30, true)
void onSelection(DBE l)
{
int sel = get abcList
if (sel >= 0) {
set(telNo, phones[sel])
} else {
set(telNo, "")
}
} // onSelection
void onActivate(DBE l)
{
int sel = get abcList
if (sel >= 0)
{
// remove selection on double-click
set(abcList, sel, false)
set(telNo, "")
}
} // onActivate
set(abcList, onSelection, onActivate)
show listBox
The user does not want to set the callbacks. He want so set a special set of preselected items in the dialog like the strings "New Jersey" and "Europe" but not "Virginia", "Texas" and "California". And there is a command but actually from memory, I do not remember.
|
|